 using System;
using System.Windows.Forms;

using GURUCORE.GForm.Core.Common;
// using GURUCORE.GException.Service;
// using GURUCORE.Log;


namespace GURUCORE.GForm.Core
{
	/// <summary>
	/// //TODO: We need to comment for GURUCORE.GForm.Core.GURUMessageBox.
	/// </summary>
	public class GURUMessageBox
	{
		private const string MESSAGE_SYSTEM_ERROR = "Can not connect to database, please check your network connection and make sure your sever is running";
		private const string ICON_REPLACE = "@";
		private const string METHOD_NAME = "GURUCORE.Util.GURUCORE.GForm.Core.GURUMessageBox.Show()";
		private const string SPACE = " OR Lack of MessageCode: ";
		public static DialogResult Show(int pintMessageCode)
		{
			try
			{
                string strMessage = string.Empty/* = ErrorMessageBO.GetErrorMessage(pintMessageCode) */ ;
				return MessageBox.Show(strMessage, Constants.APPLICATION_NAME,MessageBoxButtons.OK,MessageBoxIcon.Information);
			}
			catch 
			{
				// log message.
				try
				{
					// FileLogger.Write(MESSAGE_SYSTEM_ERROR + SPACE + pintMessageCode);
				}
				catch
				{
				}

				return MessageBox.Show(MESSAGE_SYSTEM_ERROR , Constants.APPLICATION_NAME,MessageBoxButtons.OK,MessageBoxIcon.Error);
			}
		}
        public static DialogResult Show(int pintBaseCodeMessage, int pintExtendCodeMessage)
        {
            return MessageBox.Show(string.Empty, Constants.APPLICATION_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error);
        }
public static DialogResult Show(int pintMessageCode, MessageBoxButtons pobjButton)
		{
			try
			{
				string strMessage = string.Empty /* = ErrorMessageBO.GetErrorMessage(pintMessageCode) */;
				return MessageBox.Show(strMessage, Constants.APPLICATION_NAME,pobjButton,MessageBoxIcon.Information);
			}
			catch
			{
				// log message.
				try
				{
					// FileLogger.Write(MESSAGE_SYSTEM_ERROR + SPACE + pintMessageCode);
				}
				catch
				{
				}

				return MessageBox.Show(MESSAGE_SYSTEM_ERROR , Constants.APPLICATION_NAME,MessageBoxButtons.OK,MessageBoxIcon.Error);
			}
		}

		public static DialogResult Show(int pintMessageCode,MessageBoxIcon pobjMessageBoxIcon)
		{
			try
			{
				string strMessage /* = ErrorMessageBO.GetErrorMessage(pintMessageCode) */;
				return MessageBox.Show(string.Empty, Constants.APPLICATION_NAME,MessageBoxButtons.OK,pobjMessageBoxIcon);
			}
			catch
			{
				// log message.
				try
				{
					// FileLogger.Write(MESSAGE_SYSTEM_ERROR + SPACE + pintMessageCode);
				}
				catch
				{
				}

				return MessageBox.Show(MESSAGE_SYSTEM_ERROR , Constants.APPLICATION_NAME,MessageBoxButtons.OK,MessageBoxIcon.Error);
			}
		}

		public static DialogResult Show(int pintMessageCode, MessageBoxButtons pobjButton, MessageBoxIcon pobjIcon)
		{
			try
			{
				string strMessage /* = ErrorMessageBO.GetErrorMessage(pintMessageCode) */;
				return MessageBox.Show(string.Empty, Constants.APPLICATION_NAME,pobjButton, pobjIcon);
			}
			catch
			{
				// log message.
				try
				{
					// FileLogger.Write(MESSAGE_SYSTEM_ERROR + SPACE + pintMessageCode);
				}
				catch
				{
				}

				return MessageBox.Show(MESSAGE_SYSTEM_ERROR, Constants.APPLICATION_NAME,MessageBoxButtons.OK,MessageBoxIcon.Error);
			}
		}

		public static DialogResult Show(int pintMessageCode, MessageBoxButtons pobjButton, MessageBoxIcon pobjIcon, MessageBoxDefaultButton pobjDefaultButton)
		{
			try
			{
				string strMessage /* = ErrorMessageBO.GetErrorMessage(pintMessageCode) */;
				return MessageBox.Show(string.Empty, Constants.APPLICATION_NAME,pobjButton, pobjIcon, pobjDefaultButton);
			}
			catch
			{				
				// FileLogger.Write(MESSAGE_SYSTEM_ERROR + SPACE + pintMessageCode);
		

				return MessageBox.Show(MESSAGE_SYSTEM_ERROR, Constants.APPLICATION_NAME,MessageBoxButtons.OK,MessageBoxIcon.Error);
			}
		}
		public static DialogResult Show(string pstrMessage, MessageBoxButtons pobjButton, MessageBoxIcon pobjIcon, MessageBoxDefaultButton pobjDefaultButton)
		{
			return MessageBox.Show(pstrMessage, Constants.APPLICATION_NAME,pobjButton, pobjIcon, pobjDefaultButton);
		}
		public static DialogResult Show(int pintMessageCode, MessageBoxButtons pobjButton, MessageBoxIcon pobjIcon, MessageBoxDefaultButton pobjDefaultButton, params string[] pstrParams)
		{
			const string OLD_CHAR = "@";
			try
			{
                string strMessage = string.Empty /* = ErrorMessageBO.GetErrorMessage(pintMessageCode) */;
				for(int i = 0; i < pstrParams.Length; i++)
				{
					int intIndex = strMessage.IndexOf(OLD_CHAR);
					strMessage = strMessage.Remove(intIndex,1);
					strMessage = strMessage.Insert(intIndex,pstrParams[i]);
					
				}
				return MessageBox.Show(strMessage, Constants.APPLICATION_NAME,pobjButton, pobjIcon, pobjDefaultButton);
			}
			catch
			{
				// log message.
				try
				{
					// FileLogger.Write(MESSAGE_SYSTEM_ERROR + SPACE + pintMessageCode);
				}
				catch
				{
				}

				return MessageBox.Show(MESSAGE_SYSTEM_ERROR, Constants.APPLICATION_NAME,MessageBoxButtons.OK,MessageBoxIcon.Error);
			}
		}

		public static DialogResult Show(int pintMessageCode, MessageBoxIcon pobjIcon, string[] pstrParams)
		{
			const string OLD_CHAR = "@";
			try
			{
                string strMessage = string.Empty /* = ErrorMessageBO.GetErrorMessage(pintMessageCode) */;
				for(int i = 0; i < pstrParams.Length; i++)
				{
					int intIndex = strMessage.IndexOf(OLD_CHAR);
					strMessage = strMessage.Remove(intIndex, OLD_CHAR.Length);
					strMessage = strMessage.Insert(intIndex, pstrParams[i]);
				}
				return MessageBox.Show(strMessage, Constants.APPLICATION_NAME, MessageBoxButtons.OK, pobjIcon);
			}
			catch
			{
				// log message.
				try
				{
					// FileLogger.Write(MESSAGE_SYSTEM_ERROR + SPACE + pintMessageCode);
				}
				catch
				{
				}

				return MessageBox.Show(MESSAGE_SYSTEM_ERROR, Constants.APPLICATION_NAME,MessageBoxButtons.OK,MessageBoxIcon.Error);
			}
		}

	}
}
